import request from '@/utils/request'

// 登录请求参数
export interface LoginRequest {
  username: string
  password: string
  captchaCode?: string
  captchaId?: string
  rememberMe?: boolean
}

// 验证码请求参数
export interface CaptchaRequest {
  captchaId: string
  captchaCode: string
}

// 认证API
export const authApi = {
  // 用户登录
  login: (data: LoginRequest) => {
    return request.post('/auth/login', data)
  },

  // 用户登出
  logout: () => {
    return request.post('/auth/logout')
  },

  // 获取当前用户信息
  getUserInfo: () => {
    return request.get('/auth/user-info')
  },

  // 获取用户菜单
  getUserMenus: () => {
    return request.get('/auth/user-menus')
  },

  // 获取用户权限
  getUserPermissions: () => {
    return request.get('/auth/user-permissions')
  },

  // 刷新Token
  refreshToken: () => {
    return request.post('/auth/refresh-token')
  },

  // 获取验证码
  getCaptcha: () => {
    return request.get('/captcha/get')
  },

  // 验证验证码
  verifyCaptcha: (data: CaptchaRequest) => {
    return request.post('/captcha/check', data)
  }
} 